﻿using Central_Control.Key;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Central_Control
{
    /// <summary>
    /// SetWindow.xaml 的交互逻辑
    /// </summary>
    public partial class SetWindow : Window
    {
        public SetWindow()
        {
            InitializeComponent();
        }

        private void Gallery_AddButton_Click(object sender, RoutedEventArgs e)
        {
            // 弹出对话框，让用户输入按钮名称
            string buttonName = Microsoft.VisualBasic.Interaction.InputBox("请输入新增展厅的名称:", "新增展厅", "");

            if (!string.IsNullOrEmpty(buttonName))
            {
                // 调用MainWindow的添加按钮方法
                MainWindow.instance.AddButton(buttonName);
                MainWindow.instance.RefreshUIFromJson();
            }
        }

        private void Gallery_DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            // 弹出对话框，让用户输入要删除的按钮名称
            string buttonName = Microsoft.VisualBasic.Interaction.InputBox("请输入删除展厅的名称:", "删除展厅", "");

            if (!string.IsNullOrEmpty(buttonName))
            {
                // 调用MainWindow的删除按钮方法
                bool buttonDeleted = MainWindow.instance.DeleteButton(buttonName);
                MainWindow.instance.RefreshUIFromJson();

                if (!buttonDeleted)
                {
                    MessageBox.Show("没有找到需要删除的展厅");
                }
            }
        }

        private void Gallery_AddKey_Click(object sender, RoutedEventArgs e)
        {
            string keys = Microsoft.VisualBasic.Interaction.InputBox("请输入程序激活码:", "输入激活码", "");
            if (!string.IsNullOrEmpty(keys))
            {
                Warning.instance.addKeys(keys);
            }
        }
    }
}
